﻿/**
 * @file   FITKAbaqusAdaptorSpringDashpot.h
 * @brief 弹簧阻尼器 适配器
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date 2024-06-20
 */
#ifndef __FITKABAQUSADAPTORSPRINGDASHPOT__H__
#define __FITKABAQUSADAPTORSPRINGDASHPOT__H__

#include "FITKAbaqusAbstractAdaptor.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"

 //前置声明
ForwardDeclarNS(AbaqusData, FITKDataCase)
ForwardDeclarNS(Interface, FITKAbstractModel)
ForwardDeclarNS(Interface, FITKAbaSpringDashpotPoint2Point)

namespace IO
{
    /**
     * @brief 输出时间点 读写适配器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date 2024-06-20
     */
    class FITKAbaqusIOINPAPI FITKAbaqusAdaptorSpringDashpot : public FITKAbaqusAbstractAdaptor
    {
    public:
        explicit FITKAbaqusAdaptorSpringDashpot() = default;
        ~FITKAbaqusAdaptorSpringDashpot() = default;

        /**
         * @brief 获取适配器数据类型名
         * @return 适配器数据类型名
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-20
         */
        QString getAdaptorClass() override;

        /**
         * @brief 设置模型数据part-Assembly 用于模型里的局部坐标系读写
         * @param[i] modelData 模型数据
         * @param[i] caseData 模型数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-22
         */
        void setModelDataCaseData(Interface::FITKAbstractModel* modelData, AbaqusData::FITKDataCase* caseData);

        /**
         * @brief 设置写出单元的编号
         * @param writeElementId elementId
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-28
         */
        void setWriteElementId(int* writeElementId);

        /**
         * @brief 适配器读取
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-20
         */
        bool adaptR() override;

        /**
         * @brief 适配器写出
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-20
         */
        bool adaptW() override;

    private:
        /**
         * @brief 读取两点弹簧
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-22
         */
        bool readConnectTwoPoints();
        /**
         * @brief 写出两点弹簧
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-22
         */
        bool writeConnectTwoPoints();
        /**
         * @brief 读取坐标系
         * @param[i] ori 局部坐标系名称
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-22
         */
        bool readOrientation(QString ori);
        /**
         * @brief 写出Element
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-22
         */
        bool writeElementTwoPoints();

    private:
        /**
         * @brief 算例数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-22
         */
        AbaqusData::FITKDataCase* _caseData{};
        /**
         * @brief 模型数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-22
         */
        Interface::FITKAbstractModel* _modelData{};
        /**
         * @brief 写出的编号
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        int* _writeElementId{};
    };

    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaSpringDashpotPoint2Point, FITKAbaqusAdaptorSpringDashpot);

}

#endif